cmake_minimum_required(VERSION 3.10)

set(project_name devtest)  # TODO 根据需要修改

project(${project_name} C CXX)

include(${PROJECT_SOURCE_DIR}/unittest.cmake)

# unitest 开关
option(UNIT_TEST "Enable unit test" OFF)

# cpp-stub 开关
option(CPP_STUB_ENABLE "Enable cpp-stub" OFF)

# 设置执行文件输出路径
# set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/out)
# # 设置静态库输出路径
# set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/out/bin/)

# 编译类型
set(default_build_type "Debug")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
    STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
    "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

# 包含应用源码
add_subdirectory(code)

if (UNIT_TEST)
    set_unittest()
endif ()